package com.stone.back.order.entity;

import java.util.Date;

import com.stone.back.user.entity.BfUser;
import com.stone.common.util.DateUtil;
import com.stone.common.util.SimpleDateSerializer;
import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * 订单
 * @author Stone P
 */
public class BfOrder implements java.io.Serializable {

	// Fields

	private String orderid;
	private Integer userid;
	private String username;
	private Float totalprice;
	private Integer warescount;
	private String phone;
	private String email = "";
	private Integer contact = 0;
	private String comment = "";
	private String site;
	private Date servicedate;
	private Date servicetime;
	private String deliveryremark = "";
	private Integer status = 0;
	private Date createdate;
	private Date updatedate;
	private BfUser customer;
        

	// Constructors

	/** default constructor */
	public BfOrder() {
	}

	/** minimal constructor */
	public BfOrder(String username, Float totalprice, Integer warescount, String phone, String site, Date servicedate, 
			Date servicetime, Integer status, Date createdate) {
		this.username = username;
		this.totalprice = totalprice;
		this.warescount = warescount;
		this.phone = phone;
		this.site = site;
		this.status = status;
		this.createdate = createdate;
	}

	/** full constructor */
	public BfOrder(Integer userid, String username, Float totalprice, Integer warescount, String phone, String email, Integer contact, 
			String comment, String site, Date servicedate, Date servicetime, String deliveryremark, Integer status, Date createdate, Date updatedate) {
		this.userid = userid;
		this.username = username;
		this.totalprice = totalprice;
		this.warescount = warescount;
		this.phone = phone;
		this.email = email;
		this.contact = contact;
		this.comment = comment;
		this.site = site;
		this.servicedate = servicedate;
		this.servicetime = servicetime;
		this.deliveryremark = deliveryremark;
		this.status = status;
		this.createdate = createdate;
		this.updatedate = updatedate;
	}

	// Property accessors

	public String getOrderid() {
		return this.orderid;
	}

	public void setOrderid(String orderid) {
		this.orderid = orderid;
	}

	public Integer getUserid() {
		return this.userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Float getTotalprice() {
		return this.totalprice;
	}

	public void setTotalprice(Float totalprice) {
		this.totalprice = totalprice;
	}

	public Integer getWarescount() {
		return warescount;
	}

	public void setWarescount(Integer warescount) {
		this.warescount = warescount;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Integer getContact() {
		return contact;
	}

	public String getContactStr() {
		if(0 == contact) {
			return "电话";
		} else if (1 == contact) {
			return "邮箱";
		} else {
			return "";
		}
	}

	public void setContact(Integer contact) {
		this.contact = contact;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getSite() {
		return this.site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	public Date getServicedate() {
		return this.servicedate;
	}

	public String getServicedateStr() {
		if(null != this.servicedate) {
			return DateUtil.dateFormatStr(DateUtil.DATE_FORMAT, this.servicedate);
		} else {
			return "";
		}
	}

	public void setServicedate(Date servicedate) {
		this.servicedate = servicedate;
	}

	public Date getServicetime() {
		return servicetime;
	}

	public String getServicetimeStr() {
		if(null != this.servicetime) {
			return DateUtil.dateFormatStr(DateUtil.TIME_FORMAT, this.servicetime);
		} else {
			return "";
		}
	}

	public void setServicetime(Date servicetime) {
		this.servicetime = servicetime;
	}

	public String getDeliveryremark() {
		return deliveryremark;
	}

	public void setDeliveryremark(String deliveryremark) {
		this.deliveryremark = deliveryremark;
	}

    @JsonSerialize(using = SimpleDateSerializer.class)
	public Date getCreatedate() {
		return this.createdate;
	}

	public String getCreatedateStr() {
		if(null != this.createdate) {
			return DateUtil.dateFormatStr(DateUtil.DATETIME_FORMAT, this.createdate);
		} else {
			return "";
		}
	}

	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}

	public Date getUpdatedate() {
		return this.updatedate;
	}

	public String getUpdatedateStr() {
		if(null != this.updatedate) {
			return DateUtil.dateFormatStr(DateUtil.DATETIME_FORMAT, this.updatedate);
		} else {
			return "";
		}
	}

	public void setUpdatedate(Date updatedate) {
		this.updatedate = updatedate;
	}

	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public BfUser getCustomer() {
		return customer;
	}

	public void setCustomer(BfUser customer) {
		this.customer = customer;
	}
}